package todomanager.View;
import java.io.File;

import javax.swing.ImageIcon;

public class IconManager {
    public ImageIcon createIcon(String imageName) {
    	ClassLoader cldr = this.getClass().getClassLoader();

    	String imgPath = "todomanager/icons/" + imageName;
    	java.net.URL imageURL  = cldr.getResource(imgPath);
        
        File f = new File(IconManager.class.getProtectionDomain().getCodeSource().getLocation().getPath());
        if (imageURL == null) {
            System.err.println("Resource not found: "
                               + imageURL);
            return null;
        } else {
            return new ImageIcon(imageURL);
        }
    }
}
